package br.ita.doacoes.view.cadastrodoacoes;

import java.util.Date;

import org.swingBean.descriptor.BeanTableModel;

public class OpcaoConsultaPacote implements OpcaoConsulta {

	private String contraparte;
	private String atendente;
	private Date dataInicio;
	private Date dataFinal;
	private boolean cumulativeFiltering;

	public String getAtendente() {
		return atendente;
	}
	public void setAtendente(String atendente) {
		this.atendente = atendente;
	}
	public String getContraparte() {
		return contraparte;
	}
	public void setContraparte(String contraparte) {
		this.contraparte = contraparte;
	}
	public Date getDataInicio() {
		return dataInicio;
	}
	public void setDataInicio(Date dataInicio) {
		this.dataInicio = dataInicio;
	}
	public Date getDataFinal() {
		return dataFinal;
	}
	public void setDataFinal(Date dataFinal) {
		this.dataFinal = dataFinal;
	}
	public boolean isCumulativeFiltering() {
		return cumulativeFiltering;
	}
	public void setCumulativeFiltering(boolean cumulativeFiltering) {
		this.cumulativeFiltering = cumulativeFiltering;
	}

	public void filter(BeanTableModel model) {
		if (!cumulativeFiltering)
		{
			model.cleanFilter();
		}
		model.setContinuousFiltering(true);
		model.filterContains("atendente", atendente);
		model.filterContains("contraparte", contraparte);
		model.filterBetween("data", dataInicio, dataFinal);
		model.setContinuousFiltering(false);
	}

}
